Page({

  /**
   * 页面的初始数据
   */
  data: {
    isPlayingMusic:false,
    img:[
      '../resources/砂锅粥.jpeg',
      '../resources/1.jpg',
      '../resources/10.jpg'
    ],
    array:[]
  },
  bgm:null,
  music_url:"http://localhost:3000/public/music/food.mp3",

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var array = this.initData();
    this.setData({array:array});
 

  },
  initData:function(){
    var array = [];
    var object1 = new Object();
    object1.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/2.png';
    object1.title='功夫茶';
    object1.introduce="所谓功夫茶，并非一种茶叶或茶类的名字。而是一种泡茶的技法";
    array[0]=object1;

    var object2 = new Object();
    object2.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/4.png';
    object2.title='剃胎发';
    object2.introduce="在潮汕大部分地方，婴儿出生满月时，长辈要为其剃胎发。";
    array[1]=object2;

    var object3 = new Object();
    object3.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/90.jpg';
    object3.title='七样菜';
    object3.introduce="七样菜是潮汕民间颇具特色的一种食俗，有“新春发大财”的寓意。";
    array[2]=object3;

    var object4 = new Object();
    object4.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/7.png';
    object4.title='打火油';
    object4.introduce="这是潮汕乡下入厝的驱鬼仪式，俗称“打油火”,是潮汕入厝的一种风俗.";
    array[3]=object4;

    var object5 = new Object();
    object5.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/12.jpg';
    object5.title='出花园';
    object5.introduce="“出花园”是潮汕地区一种独特的传统民俗，也就是我们俗称的“成人礼”。";
    array[4]=object5;

    var object6 = new Object();
    object6.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/3.jpg';
    object6.title='营老爷';
    object6.introduce="潮汕人的祖先来自中原地区，很多传统习俗都古代习俗，“营老爷”也如此。";
    array[5]=object6;

    var object7 = new Object();
    object7.img = 'cloud://sky-6gi88zgqc900935c.736b-sky-6gi88zgqc900935c-1306016132/musics/1.jpg';
    object7.title='潮汕音乐';
    object7.introduce="潮剧又名潮汕戏、潮音戏、潮调、白字戏，主要流行于潮汕方言区。";
    array[6]=object7;
    
    return array;
  },
 
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
     // 创建getBackgroundAudioManager实例对象
     this.bgm = wx.getBackgroundAudioManager()
     // 音频标题
     this.bgm.title = '我爱吃潮汕小吃'
     // 专辑名称
     this.bgm.epname='潮汕美食'
     // 指定音频的数据源
     this.bgm.src = this.music_url
     this.bgm.play()
  },
   // 播放器的单击事件
   play:function(){
    if(this.data.isPlayingMusic){
      this.bgm.pause()
    }else{
      this.bgm.play
    }
    this.setData({
      isPlayingMusic:!this.data.isPlayingMusic
    })
  },

})